<?php
class PeliculaModel extends Model {
	
	private $tbl_pelicula= 'PELICULA';
        
        function __construct()
        {
            parent::__construct();
        }
	
	function list_all(){
		$this->db->order_by('ID','asc');
		return $this->db->get($tbl_pelicula);
	}
	
	function count_all(){
		return $this->db->count_all($this->tbl_pelicula);
	}
	
	function get_paged_list($limit = 10, $offset = 0){
		$this->db->order_by('ID','asc');
		return $this->db->get($this->tbl_pelicula, $limit, $offset);
	}
	
	function get_by_id($id){
		$this->db->where('ID', $id);
		return $this->db->get($this->tbl_pelicula);
	}
	
	function save($pelicula){
		$this->db->insert($this->tbl_pelicula, $pelicula);
		return $this->db->insert_id();
	}
	
	function update($id, $pelicula){
		$this->db->where('ID', $id);
		$this->db->update($this->tbl_pelicula, $pelicula);
	}
	
	function delete($id){
		$this->db->where('ID', $id);
		$this->db->delete($this->tbl_pelicula);
	}
}
?>